package com.xiong.fan.proxy.cglib;

import sun.misc.ProxyGenerator;

import java.io.FileOutputStream;
import java.io.IOException;

public class CGLIBTest {

    public static void main(String[] args) throws IOException {

        Object clazz =new CGLIBQuery().getInstance(MysqlService.class);

        System.out.println(clazz.getClass());
        byte [] bytes = ProxyGenerator.generateProxyClass(clazz.getClass().toString(),new Class[]{MysqlService.class});
        FileOutputStream os = new FileOutputStream("d://$Proxy1.class");
        os.write(bytes);
        os.close();

    }
}
